<?php

namespace App\Console\Commands;

use App\Library\Logic\ShopOrderLogic;
use Illuminate\Console\Command;

class ProductOrderCancelCommand extends Command
{
    /**
     * 商品订单取消
     *
     * @var string
     */
    protected $signature = 'command:productOrderCancel {serialNumber}';

    /**
     * The console command description.
     *
     * @var string
     */
    protected $description = 'Command description';

    /**
     * Execute the console command.
     */
    public function handle(): void
    {
        $serialNumber = $this->argument('serialNumber');
        if (empty($serialNumber) || strlen($serialNumber) !== 20) return;
        //else if (prod() && time() < PHP_INT_MAX) return;
        ShopOrderLogic::cancel($serialNumber, time());
    }
}
